<?php
/**
 * 
 * Modelo de Email 
 * @author Natanael
 * 
 */
class EmailCompany extends Model
{

    private $_toMail;
    private $_titleMail;
    private $_bodyMail;
    private $_subjectMail;
    private $_fromMail;
    private $_typeMail;
    
    private function __construct()
    {
      parent::Model();
    }
    
    private function _setData($toMail, $titleMail, $bodyMail, $subjectMail, $fromMail, $typeMail)
    {
        $this->_toMail = $toMail;
        $this->_titleMail = $titleMail;
        $this->_bodyMail = $bodyMail;
        $this->_subjectMail = $subjectMail;
        $this->_fromMail = $fromMail;
        $this->_typeMail = $typeMail;
    }
    
    public function sendMail($toMail, $titleMail, $bodyMail, $subjectMail, $fromMail, $typeMail)
    {
    	$this->_setData($toMail, $titleMail, $bodyMail, $subjectMail, $fromMail, $typeMail);
    	
        if (mail($this->_toMail, $this->_titleMail,$this->_getBody(),$this->_getHeaders())) {
	    	return true;
	    }else{
	    	return false;
	    } 
    }
    
    private function _getHeaders()
    {
        $headers = "MIME-Version: 1.0\r\n"; 
	    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
	    $headers .= "From: Ibc panama <Compan24h - Lider en Gestion de Companias>\r\n"; 
	    $headers .= "Reply-To:".$this->_fromMail."\r\n";
	    
	    return $headers;
    }
    
    private function _getBody()
    {
        return $this->_bodyMail;
    }
    

}